var map = null;
var pinID = 1;

function PanMap(x,y,latlong)
{
  if (x!=null & y!=null)
  {
     map.Pan(x,y);
  }
  else if (latlong!=null)
  {
     map.PanToLatLong(latlong);
  }
}

function GetMap(geoX, geoY)
{
  CreateVE();
  map = new VEMap('myMap');
  map.LoadMap(new VELatLong(geoX, geoY), 15);
  AddPin(geoX, geoY);
}   

function CreateVE() 
{
  var panel = document.getElementById('myMap');

  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

  panel.id = "myMap";
  panel.style.top = "0px";
  panel.style.left = "0px";
  panel.style.width = myWidth + "px";
  panel.style.height = myHeight + "px";
  panel.style.background = "White";
}

function AddPin(geoX, geoY)
{   
  var pin = new VEPushpin(pinID, new VELatLong(geoX, geoY));
  map.AddPushpin(pin);
  PanMap(geoX, geoY, null);
  pinID++;
} 
